<template>
	<view >
	
		<view>
			<uni-card style="padding-bottom: 10rpx;" v-for="(item,index) in stuList" :key="item.classId" @click="cellPhone(item.studentPhone)">
					<uni-row>
						<uni-col :span="12">
							<view style="font-size: 30rpx; font-weight: bold;">{{item.studentName}}</view>
						</uni-col>
						<uni-col :span="8">
							<view style="text-align: right;">{{item.dormitoryAddress}}</view>
						</uni-col>
					</uni-row>
					<uni-row v-if="item.deviceName != null">
						<uni-col :span="8">
							<view style="line-height: 35px; display: flex; ">{{item.deviceName}}</view>
						</uni-col>
						<uni-col :span="16">
							<view style="line-height: 35px; display: flex; ">打卡时间：
								<view style="color: #fe0000;" >{{item.createTime}}</view>
							</view>
						</uni-col>
					</uni-row>
					  
				<!--   	<view class="" style="letter-spacing:3rpx;width:30%; text-align: center;">
				   		{{convertToChineseNumeral(item.storey)}}层/{{item.dormitoryNo}}
				   	</view>
				   	<view style="width:30%; text-align: center;">{{item.studentName}}</view>
				   	<view class="miniButton" style="background-color: hotpink;" @click="toDetail(item)">添加违纪</view> -->
				   </uni-card>
		<!-- 	<view style="padding: 10px;height: 35px;">	
				<uni-list style="margin-top: 15rpx;">
					<uni-list :border="true">
						<uni-list-item :title='item.studentName' :note='item.deviceName' :right-text='item.dormitoryAddress' clickable="true"  @click="cellPhone(item.studentPhone)"  v-for="item in stuList" class="title">
						</uni-list-item>
					</uni-list> 
				</uni-list>
			</view> -->
			<view v-if="stuList.length <= 0">
				<image style="width: 400rpx;height: 400rpx; position: absolute; left: 20%; top:20%"
					src="https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/wujilu.png" mode=""></image>
			</view>
		</view>
	</view>
</template>

<script>
   import dormitory from '@/api/modules/dormitory'
   	import {
   		parseTime
   	} from "@/utils/date.js"
	export default {
		data() {
			return {
				value:'',
				single: "",
				userName: '',
				topName: '',
				id: '',
				classId: '',
				dateTime: '',
				type: '',
				className:"",	
				userId:"",
				stuList:[],

			}
		},
		onShow() {
			var that = this
			uni.getStorage({
				key: "loginName",
				success: (res) => {
					that.userName = res.data//获取用户姓名
				}
			})
			uni.getStorage({
				key: "loginId",
				success: (res) => {
					that.userId = res.data//获取用户id
				}
			})
		
		
			// this.topName=this.className+"班",
		},
		methods: {
			getStudentList(){
				dormitory.getDormitoryStudentListByType(this.classId, this.dateTime, this.type).then(res=>{
					this.stuList=res.data
				})
			},
					cellPhone(phone) {
										const res = uni.getSystemInfoSync();
										// ios系统默认有个模态框
										if (res.platform == 'ios') {
											uni.makePhoneCall({
												phoneNumber: phone,
											})
										} else {
											//安卓手机手动设置一个showActionSheet
											uni.showActionSheet({
												itemList: ['phone', '呼叫'],
												success: function(res) {
													if (res.tapIndex == 1) {
														uni.makePhoneCall({
															phoneNumber: phone,
														})
													}
												}
											})
										}
						
						}
		},
		onLoad(options) {
			this.dateTime = options.dateTime
			this.classId = options.classId
			this.type = options.type
			console.log(this.dateTime)
			this.className = options.className
			this.topName = this.className
			this.getStudentList()
		}
	}
</script>

<style>
.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	},
	.title{
		font-size: 18rpx;
		font-weight: bolder;
	}
	 
/* 	::v-deep .uni-select__selector-item text{
			white-space: nowrap !important;
	    text-overflow: ellipsis !important;
	    overflow: hidden !important;
	    -o-text-overflow: ellipsis !important; 
	    width: 270rpx !important;
	}
	 */	
</style>
